/*************************************************************************
	> File Name: P1638.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-03 10:19:38
 ************************************************************************/
#include <iostream>
#include <deque>
#include <cstdio>
using namespace std;

#define MAX_N 1000000
#define MAX_M 2000

int arr[MAX_N + 5];
int cnt[MAX_M + 5];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        scanf("%d", arr + i);
    }
    int sum = 0, min_len = INT32_MAX;
    int l = 0, r = 0;
    deque<int> q;
    for (int i = 1; i <= n; i++) {
        if (cnt[arr[i]] == 0) sum += 1;
        cnt[arr[i]]++;
        q.push_back(i);
        while (!q.empty() && cnt[arr[q.front()]] > 1) {
            cnt[arr[q.front()]]--;
            q.pop_front();
        }
        if (sum == m) {
            if (q.size() < min_len) {
                min_len = q.size();
                l = q.front();
                r = q.back();
            }
        }
    }
    printf("%d %d\n", l, r);
    return 0;
}
